﻿using JNPF.Basics.Logic;
using JNPF.Basics.Models.WorkFlow.Model;
using JNPF.Utils;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace JNPF.Basics.Controller
{
    /// <summary>
    /// HelloWorld
    /// 版 本：V3.0.0
    /// 版 权：引迈信息技术有限公司（https://www.jnpfsoft.com）
    /// 作 者：JNPF开发平台组
    /// 日 期：2020-05-30 
    /// </summary>
    [Route("api/Basics/[controller]")]
    public class HelloWorldController : ControllerBase
    {
        private FlowEngineBll flowEngineBll = new FlowEngineBll();
        private FlowTaskBll flowTaskBll = new FlowTaskBll();
        /// <summary>
        /// HelloWorld
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        public async Task<ResponseResult> Get()
        {
            var info = await flowEngineBll.GetInfo("8b48318dfc664bdda50c2240fe8f4cdc");
            var flowTemplateJsonModel = info.FlowTemplateJson.ToObject<FlowTemplateJsonModel>();
            var list = new List<ChildNodeModelList>();
            flowTaskBll.GetFlowTemplateAll(flowTemplateJsonModel, list);
            return new ResponseResult();
        }
    }
}
